import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testcase = "dbshop014-删除分类"

firefox = openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)

# 1.点击添加分类按钮，
firefox.find_element_by_xpath('//i[@class="icon-th-list icon-white"]').click()

#  点击删除分类
firefox.find_element_by_xpath('//td[contains(.,"%s")]/following-sibling::td[4]/a[3]'%goodsClassName).click()
time.sleep(5)
#js弹框的处理
firefox.switch_to.alert.accept()
time.sleep(10)
#断言
try:
    firefox.find_element_by_xpath('//td[contains(.,"%s")]'%goodsClassName).is_displayed()
    writeLog("%s 测试失败"%testcase)
    getPhoto(firefox)
except:
    writeLog("%s 测试通过" % testcase)
firefox.quit()